pub struct Solution;

impl Solution {
    pub fn maximum_binary_string(binary: String) -> String {
        let mut result = String::from(&binary);
        fn can_do(num_str: &String) -> bool {
            num_str
                .chars()
                .collect::<Vec<char>>()
                .windows(2)
                .into_iter()
                .any(|v| {
                    let x = v.into_iter().collect::<String>();
                    match x.as_str() {
                        "00" => true,
                        _ => false,
                    }
                })
        }

        while can_do(&result) {
            result = result.replace("00","10");
        }
        result
    }
}

#[test]
pub fn test() {
    assert_eq!(Solution::maximum_binary_string("000110".to_string()), "111011".to_string());
}